package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "approval_record", schema = "crm")
/** 审批记录*/
public class ApprovalRecord {
    private int approvalRecordId;
    private Timestamp approvalRecordTime;//审批详细时间 2
    private String approvalRecordOper;//审批操作 2
    private String approvalRecordNote;//审批备注 2
    private Date approvalRecordDate;//审批发起日期 1
    private Businesstrip businesstripByBusinessId;
    private PaymentPlan paymentPlanByPaymentPlanId;
    private Quotation quotationByQuotationId;
    private Purchase purchaseByPurchaseId;
    private Contract contractByContractId;
    private Employee employeeByApplicantEmpId;// 申请人
    private Employee employeeByApprovalEmpId;// 审批人

    @Id
    @Column(name = "approval_record_id", nullable = false)
    public int getApprovalRecordId() {
        return approvalRecordId;
    }

    public void setApprovalRecordId(int approvalRecordId) {
        this.approvalRecordId = approvalRecordId;
    }


    @Basic
    @Column(name = "approval_record_time", nullable = false)
    public Timestamp getApprovalRecordTime() {
        return approvalRecordTime;
    }

    public void setApprovalRecordTime(Timestamp approvalRecordTime) {
        this.approvalRecordTime = approvalRecordTime;
    }

    @Basic
    @Column(name = "approval_record_oper", nullable = true, length = 255)
    public String getApprovalRecordOper() {
        return approvalRecordOper;
    }

    public void setApprovalRecordOper(String approvalRecordOper) {
        this.approvalRecordOper = approvalRecordOper;
    }

    @Basic
    @Column(name = "approval_record_note", nullable = true, length = 255)
    public String getApprovalRecordNote() {
        return approvalRecordNote;
    }

    public void setApprovalRecordNote(String approvalRecordNote) {
        this.approvalRecordNote = approvalRecordNote;
    }


    @Basic
    @Column(name = "approval_record_date", nullable = true)
    public Date getApprovalRecordDate() {
        return approvalRecordDate;
    }

    public void setApprovalRecordDate(Date approvalRecordDate) {
        this.approvalRecordDate = approvalRecordDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ApprovalRecord that = (ApprovalRecord) o;
        return approvalRecordId == that.approvalRecordId &&
                Objects.equals(approvalRecordTime, that.approvalRecordTime) &&
                Objects.equals(approvalRecordOper, that.approvalRecordOper) &&
                Objects.equals(approvalRecordNote, that.approvalRecordNote) &&
                Objects.equals(approvalRecordDate, that.approvalRecordDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(approvalRecordId, approvalRecordTime, approvalRecordOper, approvalRecordNote, approvalRecordDate);
    }

    @ManyToOne
    @JoinColumn(name = "business_id", referencedColumnName = "business_id")
    public Businesstrip getBusinesstripByBusinessId() {
        return businesstripByBusinessId;
    }

    public void setBusinesstripByBusinessId(Businesstrip businesstripByBusinessId) {
        this.businesstripByBusinessId = businesstripByBusinessId;
    }

    @ManyToOne
    @JoinColumn(name = "payment_plan_id", referencedColumnName = "payment_plan_id")
    public PaymentPlan getPaymentPlanByPaymentPlanId() {
        return paymentPlanByPaymentPlanId;
    }

    public void setPaymentPlanByPaymentPlanId(PaymentPlan paymentPlanByPaymentPlanId) {
        this.paymentPlanByPaymentPlanId = paymentPlanByPaymentPlanId;
    }

    @ManyToOne
    @JoinColumn(name = "quotation_id", referencedColumnName = "quotation_id")
    public Quotation getQuotationByQuotationId() {
        return quotationByQuotationId;
    }

    public void setQuotationByQuotationId(Quotation quotationByQuotationId) {
        this.quotationByQuotationId = quotationByQuotationId;
    }


    @ManyToOne
    @JoinColumn(name = "purchase_id", referencedColumnName = "purchase_id")
    public Purchase getPurchaseByPurchaseId() {
        return purchaseByPurchaseId;
    }

    public void setPurchaseByPurchaseId(Purchase purchaseByPurchaseId) {
        this.purchaseByPurchaseId = purchaseByPurchaseId;
    }

    @ManyToOne
    @JoinColumn(name = "applicant_emp_id", referencedColumnName = "emp_id")
    public Employee getEmployeeByApplicantEmpId() {
        return employeeByApplicantEmpId;
    }

    public void setEmployeeByApplicantEmpId(Employee employeeByApplicantEmpId) {
        this.employeeByApplicantEmpId = employeeByApplicantEmpId;
    }

    @ManyToOne
    @JoinColumn(name = "approval_emp_id", referencedColumnName = "emp_id")
    public Employee getEmployeeByApprovalEmpId() {
        return employeeByApprovalEmpId;
    }

    public void setEmployeeByApprovalEmpId(Employee employeeByApprovalEmpId) {
        this.employeeByApprovalEmpId = employeeByApprovalEmpId;
    }

    @ManyToOne
    @JoinColumn(name = "contract_id", referencedColumnName = "contract_id")
    public Contract getContractByContractId() {
        return contractByContractId;
    }

    public void setContractByContractId(Contract contractByContractId) {
        this.contractByContractId = contractByContractId;
    }
}
